package com.dxl.bean.session;

import java.io.Serializable;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import com.dxl.common.utils.Utils;
import com.dxl.entity.account.Account;
import com.dxl.entity.account.Function;

public class Session implements Serializable {
	private static final long serialVersionUID = -6773448043841730876L;
	private String id;
	private Account account; 
	private List<Function> functions;
	private String ip;
	
	private Set<String> functionCodes = new HashSet<String>(); // 账户功能集代码
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public Account getAccount() {
		return account;
	}
	public void setAccount(Account account) {
		this.account = account;
	}
	public List<Function> getFunctions() {
		return functions;
	}
	public Set<String> getFunctionCodes() {
		this.functionCodes.clear();
		if (Utils.isNotEmpty(this.functions)) {
			for (Function function : this.functions) {
				this.functionCodes.add(function.getCode());
			}
		}
		return functionCodes;
	}
	public void setFunctions(List<Function> functions) {
		this.functions = functions;
	}
	public String getIp() {
		return ip;
	}
	public void setIp(String ip) {
		this.ip = ip;
	}
}
